package org.esgi.ppa.controller;

import java.io.File;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class UnitTest implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	// URL de connexion
	private String url;
	//Methode POST ou GET
	private String method;
	//
	private int requests, connexions;
	//
	private int ID;
	//header a envoie dans le requete
	private HashMap<String, String> headers;
	//parameter ajouter dans le requete
	private HashMap<String, String> parameters;
	//file de response attendu
	private File fileResult;
	// Resultat de comparaison entre les reponses
	private boolean result;
	//Resultat de header de HttpConnexion
	private Map<String, List<String>>response=new HashMap<String, List<String>>();
	private long tempsReponse;
	public UnitTest(){
	}
	
	public UnitTest(int id, 
			String url, 
			String method, 
			int requests, 
			int connexions, 
			HashMap<String, String> headers, 
			HashMap<String, String> parameters,File res){
		
		this.ID = id;
		this.url = url;
		this.method = method;
		this.requests = requests;
		this.connexions = connexions;
		this.headers = headers;
		this.parameters = parameters;
		this.fileResult=res;
	}

	public int getRequests() {
		return requests;
	}

	public void setRequests(int requests) {
		this.requests = requests;
	}
	
	public void setUrl(String url){
		this.url = url;
	}
	
	public String getUrl() {
		return url;
	}
	
	public int getConnexions() {
		return connexions;
	}

	public void setConnexions(int connexions) {
		this.connexions = connexions;
	}

	public int getID() {
		return ID;
	}

	public void setID(int iD) {
		ID = iD;
	}

	public String getMethod() {
		return method;
	}
	
	public void setMethod(String method){
		this.method = method;
	}
	
	public HashMap<String, String> getParameters(){
		return this.parameters;
	}
	
	public String getParameter(String key){
		return this.parameters.get(key);
	}
	
	public HashMap<String, String> getheaders(){
		return this.headers;
	}
	//TODO setParameters()
	//TODO setParameter()
	public String getheader(String key){
		return this.headers.get(key);
	}
	//TODO setHeader()
	public void setFileResult(String path){
		this.fileResult=new File(path);
	}
	public File getFileResult(){
		return fileResult;
	}
	public HashMap<String, List<String>> getResponses(){
		return (HashMap<String, List<String>>) this.response;
	}
	public void setResponses(Map<String, List<String>> map){
		this.response=map;
	}
	public List<String> getResponse(String key){
		return this.response.get(key);
	}
	public void setResult(boolean res){
		this.result=res;
	}
	public boolean getresult(){
		return this.result;
	}
	public void setTempsReponse(long temps){
		this.tempsReponse=temps;
	}
	public long getTempsReponse(){
		return this.tempsReponse;
	}
}
